<?php $this->displayTemplate('header') ?>

<!-- Database configuration -->
<div id="dbPart">
	<h2><?php echo $this->l('Configure your database by filling out the following fields:') ?></h2>
	<p>
		<?php echo $this->l('You have to create a database, help available in <a href="http://doc.milebiz.com" target="_blank">our online documentation</a>.') ?>
	</p>

	<div id="formCheckSQL">
		<p class="first" style="margin-top: 15px;">
			<label for="dbServer"><?php echo $this->l('Database server address:') ?> </label>
			<input size="25" class="text" type="text" id="dbServer" name="dbServer" value="<?php echo htmlspecialchars($this->database_server) ?>" />
			<span class="userInfos aligned"><?php echo $this->l('If you want to use a different port, add :XX after your server address where XX is your port number.') ?></span>
		</p>
		<p>
			<label for="dbName"><?php echo $this->l('Database name:') ?> </label>
			<input size="10" class="text" type="text" id="dbName" name="dbName" value="<?php echo htmlspecialchars($this->database_name) ?>" />
		</p>
		<p>
			<label for="dbLogin"><?php echo $this->l('Database login:') ?> </label>
			<input class="text" size="10" type="text" id="dbLogin" name="dbLogin" value="<?php echo htmlspecialchars($this->database_login) ?>" />
		</p>
		<p>
			<label for="dbPassword"><?php echo $this->l('Database password:') ?> </label>
			<input class="text" size="10" type="password" id="dbPassword" name="dbPassword" value="<?php echo htmlspecialchars($this->database_password) ?>" />
		</p>
		<p>
			<label for="dbEngine"><?php echo $this->l('Database Engine:') ?></label>
			<select id="dbEngine" name="dbEngine">
				<option value="InnoDB" <?php if ($this->database_engine == 'InnoDB'): ?>selected="selected"<?php endif; ?>>InnoDB</option>
				<option value="MyISAM" <?php if ($this->database_engine == 'MyISAM'): ?>selected="selected"<?php endif; ?>>MyISAM</option>
			</select>
		</p>
		<p>
			<label for="db_prefix"><?php echo $this->l('Tables prefix:')?></label>
			<input class="text" type="text" id="db_prefix" name="db_prefix" value="<?php echo htmlspecialchars($this->database_prefix) ?>" />
		</p>
		<?php if (_PS_MODE_DEV_): ?>
			<p>
				<label for="db_clear"><?php echo $this->l('Drop existing tables (mode dev):')?></label>
				<input type="checkbox" name="database_clear" id="db_clear" value="1" <?php if ($this->database_clear): ?>checked="checked"<?php endif; ?> />
			</p>
		<?php endif; ?>
		<p class="aligned last">
			<input id="btTestDB" class="button" type="button" value="<?php echo $this->l('Verify now!') ?>"/>
		</p>

		<?php if ($this->errors): ?>
			<p id="dbResultCheck" class="errorBlock"><?php echo implode('<br />', $this->errors) ?></p>
		<?php else: ?>
			<p id="dbResultCheck" style="display: none;"></p>
		<?php endif; ?>
	</div>
</div>

<!-- Email configuration -->
<div id="mailPart">
	<h2><?php echo $this->l('E-mail delivery set-up') ?></h2>

	<p id="configsmtp">
		<input type="checkbox" id="set_stmp" name="smtpChecked" style="vertical-align: middle;" <?php if ($this->use_smtp): ?>checked="checked"<?php endif; ?> />
		<label for="set_stmp"><?php echo $this->l('Configure SMTP manually (advanced users only)'); ?></label><br/>

		<span class="userInfos"><?php echo $this->l('By default, the PHP mail() function is used'); ?></span>
	</p>

	<div id="mailSMTPParam">
		<div class="aligned">
			<p>
				<label for="smtpSrv"><?php echo $this->l('SMTP server address:') ?> </label>
				<input class="text" type="text" id="smtpSrv" name="smtpSrv" value="<?php echo htmlspecialchars($this->smtp_server) ?>"/>
			</p>
			<p>
				<label for="smtpEnc"><?php echo $this->l('Encryption:') ?></label>
				<select id="smtpEnc" name="smtpEnc">
					<option value="off" <?php if ($this->smtp_encryption == 'off'): ?>selected="selected"<?php endif; ?>><?php echo $this->l('None') ?></option>
					<option value="tls" <?php if ($this->smtp_encryption == 'tls'): ?>selected="selected"<?php endif; ?>>TLS</option>
					<option value="ssl" <?php if ($this->smtp_encryption == 'ssl'): ?>selected="selected"<?php endif; ?>>SSL</option>
				</select>
			</p>

			<p>
				<label for="smtpPort"><?php echo $this->l('Port:') ?></label>
				<input type="text" size="5" id="smtpPort" name="smtpPort" class="text" value="<?php echo htmlspecialchars($this->smtp_port) ?>" />
			</p>

			<p>
				<label for="smtpLogin"><?php echo $this->l('Login:') ?> </label>
				<input class="text" type="text" size="10" id="smtpLogin" name="smtpLogin" value="<?php echo htmlspecialchars($this->smtp_login) ?>" />
			</p>

			<p>
				<label for="smtpPassword"><?php echo $this->l('Password:') ?> </label>
				<input autocomplete="off" class="text" type="password" size="10" id="smtpPassword" name="smtpPassword" value="<?php echo htmlspecialchars($this->smtp_password) ?>" />
			</p>
		</div>
	</div>
	<p>
		<input class="text" id="testEmail" type="text" size="15" value="<?php echo $this->l('enter@your.email') ?>" /> &nbsp;
		<input id="btVerifyMail" class="button" type="button" value="<?php echo $this->l('Send me a test email!') ?>" />
	</p>
	<p id="mailResultCheck" style="display: none;"></p>
</div>

<?php $this->displayTemplate('footer') ?>